package bit.demo2;

public class Student {

    private String name;
    private int age = 100 ;//实例成员变量
    //age = 100;
    public static String classRoom = "888Java";
    //classRoom = "119Java";

    {
        age = 9;
        System.out.println("实例代码块执行了...");
    }

    static {
        classRoom = "119Java";
        System.out.println("静态代码块被执行了....");
    }



    public Student() {
        System.out.println("不带参数的构造方法被执行了....");
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("构造方法被执行了....");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    public void testFunc() {
        System.out.println("testFunc方法执行了.....");

        testStatic();
    }

    //静态方法 -》 类方法
    public static void testStatic() {
        System.out.println("static方法执行了...");

        //System.out.println("name:" + this.getName());

        /*Student student1 = new Student("张三",10);
        student1.testFunc();*/
    }

}
